#include <iostream>

#include "logger.h"
#include "timestamp.h"
Logger& Logger::instance(){
    static Logger logger;
    return logger;
}

void Logger::setLogLevel(LogLevel level){
    logLevel_ = level;
}

void Logger::log(std::string msg){
    switch (logLevel_)
    {
        case LogLevel::INFO:
            std::cout<<"[INFO]";
            break;
        
        case LogLevel::ERROR:
            std::cout<<"[ERROR]";
            break;
        
        case LogLevel::FATAL:
            std::cout<<"[FATAL]";
            break;
        
        case LogLevel::DEBUG:
            std::cout<<"[DEBUG]";
            break;

        default:
            break;
    }

    // 打印时间 与 msg
    std::cout << TimeStamp::now().toString() << " : " << msg << std::endl;


}